<template>
	<view class="background">
		<view class="content">
			<text style="margin-left: 5%;">意见反馈</text>
			<view style="display: flex; flex-direction: column; align-items: center;">
				<textarea maxlength="200" placeholder="请在此处写上您的意见" v-model="txt" />
			</view>
		</view>
		<view class="bottom-view">
			<view @tap="get()" class="bottom-btn">
				<text>提交</text>
			</view>
		</view>
	</view>
</template>

<script>
	import api from '@/api/index.js'
	export default {
		data() {
			return {
				txt:''
			}
		},
		onLoad() {
			
		},
		methods: {
			get(txt) {
				if(!this.txt){
					uni.showToast({
						title: "意见反馈不也能为空",
						icon:'none'
					})	
					return
				}
				api.service.createFeedback({content: this.txt}).then(res=>{
					if(res.code == 200 ){
						uni.showToast({
							title:'提交成功',
							icon:'none'
						})
						setTimeout(()=>{
							uni.navigateBack()
						},1000)
					}else{
						uni.showToast({
							title: res.msg,
							icon:'none'
						})
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.background {
		height: 100%;
		background: #F7F7F7;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
		.content {
			text {
				color: #080808;
				font-size: 34rpx;
				margin-top: 20rpx;
				font-weight: bold;
			}
			textarea{
				width: 650upx;
				height: 280rpx;
				border-radius: 12upx;
				margin-top: 20rpx;
				border: 1rpx solid #EEEEEE;
				font-size: 30rpx;
				line-height: 45rpx;
				padding: 20upx;
				background-color: #FFFFFF;
			}
		}
		.bottom-view {
			height: 150upx;
			display: flex;
			flex-direction: row;
			justify-content: center;
			background: #FFFFFF;
			.bottom-btn {
				width: 90%;
				margin-top: 10upx;
				height: 100upx;
				border-radius: 16upx;
				display: flex;
				flex-direction: row;
				justify-content: center;
				align-items: center;
				background: #2697FF;
				color: #FFFFFF;
			}
		}
	}
</style>
